<template>
	<view class="index" style="background-color: #eceff6; padding: 0; margin: 0; padding-top: 20rpx;">
		<view class="einvoiceBlockInfo_box">
			<view class="zhang">
				<u-image mode="widthFix" width="180rpx" src="/static/assets/blockChainZhang.png"></u-image>
			</view>
			<view class="info_title">河北财政电子票据区块链证书</view>

			<view class="info_content">
				<view>
					<text class="info_content_lable">区块高度</text>
					<view class="info_content_data">{{ blockData.blockNO }}</view>
				</view>
				<view>
					<text class="info_content_lable">区块哈希值</text>
					<view class="info_content_data">{{ blockData.blockchainNO }}</view>
				</view>
				<view>
					<text class="info_content_lable">成块时间</text>
					<view class="info_content_data">{{ blockData.onBlockchainDT }}</view>
				</view>
				<view>
					<text class="info_content_lable">所在链</text>
					<view class="info_content_data" style="font-family: '黑体';">
						<view style="margin-top: 2rpx;">河北财政电子票据链</view>
						<view style="margin-top: 4rpx;">
							（{{ blockData.blockchainPlace === 'hebfschannelpsbc' ? '中国邮政储蓄银行' : '中国银行' }}）
						</view>
					</view>
				</view>
			</view>

			<view class="info_content_foot">
				<u-image src="/static/assets/dashed.jpg" mode="widthFix" height="2px"></u-image>
				<view class="info_content_foot1">
					<text class="info_lable" >开票单位</text>
					<text class="info_value" >{{ blockData.invoicingPartyname }}</text>
				</view>
				<view class="info_content_foot2">
					<text class="info_lable" >开票时间</text>
					<text class="info_value" >{{ blockData.writeDate }}</text>
				</view>
				<view class="info_content_foot2">
					<text class="info_lable" >票据号码</text>
					<text class="info_value" >{{ blockData.einvoice }}</text>
				</view>
				<view class="info_content_foot2">
					<text class="info_lable" >交款人</text>
					<text class="info_value" >{{ blockData.payerPartyname }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { qklMessage} from '@/api/ticketApi.js'
	export default {
		data() {
			return {
				blockData: {}
			};
		},
		onLoad(options) {			
			const {
				einvoiceCode,
				einvoiceNumber
			} = JSON.parse(decodeURIComponent(options.item));
			this.fetchData(einvoiceCode, einvoiceNumber);
		},
		methods: {
			async fetchData(einvoiceCode, einvoiceNumber) {
				uni.showLoading({
					title: '加载中'
				});
				try {
					const param = {
						einvoiceCode,
						einvoiceNumber
					}
					const res = await qklMessage(param);
					console.log('res2', res)
					if (res.data.result == 0) {
						this.blockData = res.data;
					}
				} catch (err) {
					console.error('请求失败:', err);
				} finally {
					uni.hideLoading();
				}
			}
		}
	};
</script>

<style scoped>
	/* 区块链样式 - 单位统一改为rpx */
	.einvoiceBlockInfo_box {
		width: 90%;
		height: 100vh;
		background: no-repeat url('https://pay.hebcz.cn/officialaccount/static/images/blockChainBG.png');
		background-size: 100%;
		margin: 0 auto;
		position: relative;
	}

	.einvoiceBlockInfo_box .zhang {
		position: absolute;
		top: 615rpx;
		right: 20rpx;
		transform: rotate(345deg);
	}

	.einvoiceBlockInfo_box .info_title {
		font-size: 30rpx;
		text-align: center;
		color: #0b90f9;
		padding-top: 130rpx;
		height: 27rpx;
		line-height: 27rpx;
		width: 100%;
		margin: 0 auto;
		letter-spacing: 2rpx;
	}

	.einvoiceBlockInfo_box .info_content {
		margin-top: 60rpx;
		width: 74%;
		margin-left: 90rpx;
		margin-bottom: 15rpx;
	}

	.einvoiceBlockInfo_box .info_content .info_content_lable {
		font-size: 26rpx;
		color: #8f8f8f;
		letter-spacing: 3rpx;
	}

	.einvoiceBlockInfo_box .info_content .info_content_data {
		color: #000;
		background-color: #f5f8ff;
		min-height: 33rpx;
		padding: 10rpx 0;
		font-size: 26rpx;
		letter-spacing: 1rpx;
		margin: 20rpx 0;
		text-align: center;
		word-break: break-all;
		box-sizing: border-box;
	}

	.einvoiceBlockInfo_box .info_content_foot {
		width: 80%;
		margin-left: 70rpx;
		overflow: hidden;
		color: #8f8f8f;
		font-size: 26rpx;
		letter-spacing: 1rpx;
	}
	.info_lable{
		float: left; width: 24%;
	}
	.info_value{
		float: right; width: 75%; text-align: right;
	}
	.einvoiceBlockInfo_box .info_content_foot .info_content_foot1 {
		margin-top: 18rpx;
		width: 100%;
		line-height: 40rpx;
		overflow: hidden;
	}

	.einvoiceBlockInfo_box .info_content_foot .info_content_foot2 {
		margin-top: 7rpx;
		width: 100%;
		line-height: 40rpx;
		overflow: hidden;
	}

	/* 基础样式 - 单位转换为rpx */
	.index {
		width: 100%;
		min-height: 100vh;
		background-color: white;
	}

	.bgIndex {
		width: 100%;
		height: 100vh;
		background-color: white;
	}

	.bgIndexs {
		width: 100%;
		height: 100vh;
		background-color: #f7f8f9;
	}

	.bannerView {
		margin-left: 30rpx;
		margin-right: 30rpx;
	}

	.bannerImage {
		margin-top: 20rpx;
		width: 100%;
	}

	/* 其他必要样式保持单位为rpx */
</style>